package main
import(
	"fmt"
)

func main(){

  //方式2
  b := make(map[int]string)
  //增加
  b[20090291] = "eric"
  b[20090289] = "gwq"
  fmt.Println(b)
  //4.获取长度
  fmt.Println(len(b))
  //5.遍历
  for k,v := range b {
    fmt.Printf("\nkey为: %v,value为: %v\t",k,v)
  }
  fmt.Println("\n-------")
  //修改
  b[20090291] = "GG"
  fmt.Println(b)
  //删除
  delete(b,20090289)
  fmt.Println(b)
  //查找
  value,flag := b[20090291]
  fmt.Println(flag,value)
  //获取长度
  fmt.Println(len(b))
  fmt.Println("\n-------")
  //加深难度
  a := make(map[string]map[int]string)
  //赋值
  a["class1"] = make(map[int]string)
  a["class1"][2008022] = "aa"
  a["class1"][2008033] = "bb"
  a["class1"][2008044] = "cc"
  a["class2"] = make(map[int]string)
  a["class2"][2008055] = "33"
  a["class2"][2008066] = "44"
  a["class2"][2008088] = "55"
  for kk,vv := range a {
    fmt.Println("\n",kk)
    for kkk,vvv := range vv {
    fmt.Printf("\n学生学号: %v 学生姓名: %v \t",kkk,vvv)
    }
    fmt.Println()
  }
  

}
